/************************************************************************************
* Y.h                                                                               *
*                                                                                   *
* Copyright (C) 2011 Varuna L Amachi                                                *
*                                                                                   *
* This program is free software; you can redistribute it and/or modify              *
* it under the terms of the GNU General Public License as published by              *
* the Free Software Foundation; either version 2 of the License, or any             *
* later version.                                                                    *
*                                                                                   *
* This program is distributed in the hope that it will be useful, but               *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY        *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for       *
* more details. You should have received a copy of the GNU General Public           *
* License along with this program; if not, write to the Free Software Foundation,   *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                       *
*                                                                                   *
*************************************************************************************/

#ifndef Y_H
#define Y_H

#include <QHash>
#include <QString>
#include <QVariant>

class Y
{

private:

    QHash<QString, QVariant*> m_confMap;
    static Y* __instance;
    Y();
    void init();

public:
    static Y* get();

    void      addConfig(QString key, QVariant* value);
    void      addConfig(QString key, QString value);
    void      addConfig(QString key, int value);
    void      addConfig(QString key, double value);
    void      removeConfig(QString key);

    bool      has(QString key);
    QVariant* config(QString key, QVariant* fallback = NULL);
    QString   string(QString key, QString &fallback);
    long      number(QString key, int fallback);
    double    real(QString key, double fallback);
    QColor    color(QString key, QColor &fallback);
    QFont     font(QString key, QFont &fallback);
    QSize     size(QString key, QSize &fallback);
    QImage    image(QString key, QImage &fallback);
};

#endif // Y_H
